<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button class="btn">点我发送请求</button>
  </body>

  <script>
    document.querySelector(".btn").addEventListener("click", function () {
      const xhr = new XMLHttpRequest();
      xhr.open("get", "http://localhost:3000/getXML", false);
      xhr.onload = function () {
        const res = xhr.responseText;
        console.log(res);
      };
      xhr.send();
    });
  </script>
</html>
